<!-- Home -->
<template>
  <div class="home">
    <div class="left">
      <Left></Left>
    </div>
    <div class="content">
      <div class="header">
        <Header v-if="isChecked"></Header>
        <OperatorHeader v-if="!isChecked"></OperatorHeader>
      </div>
      <div class="main-content">
        <router-view v-if="isRouterAlive"></router-view>
      </div>
    </div>
  </div>
</template>

<script>
import OperatorHeader from "../components/OperatorHeader";
import Header from "../components/Header";
import Left from "../components/Left";
export default {
  name: "App",
  components: {
    Header,
    Left,
    OperatorHeader,
  },
  data() {
    return {
      isRouterAlive: true,
      input: "String",
    };
  },
  computed: {
    isChecked() {
      return this.$store.getters["photo/selectedCount"] == 0;
    },
    isPhoto: function () {
      return this.$route.path == "/home/photo";
    },
  },
  methods: {
    async reload() {
      let self = this;
      self.isRouterAlive = false;
      self.$nextTick(async function () {
        console.log("reload");
        // let res = await self.$get("/imgcenter/displayByMonth");
        // if (res.success == true) {
        //   self.$store.dispatch("photo/storeImageInfo", res.data.imageMap);
        // }
        self.isRouterAlive = true;
      });
    },
  },
  provide() {
    return {
      reload: this.reload,
    };
  },
};
</script>

<style  scoped>
.home {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: row;
}
.left {
  display: flex;
  width: 60px;
  height: inherit;
  border: 0px solid;
}

.content {
  flex: 1;
  height: 100%;
  display: flex;
  flex-direction: column;
  background: whitesmoke;
  overflow-y: auto;
  overflow-x: auto;
}
.header {
  height: 60px;
}

.main-content {
  flex: 1;
  padding: 5px;
  height: 90%;
  overflow: hidden;
}
.search {
  align-self: flex-end;
}
</style>
